package com.todo.strategy.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/7/3 15:10
 * @description
 */
@Getter
@AllArgsConstructor
public enum TravelStatusEnum {
    NOT_STARTED(0, "NOT_STARTED", "未开始"),
    IN_PROGRESS(1, "IN_PROGRESS", "进行中"),
    ENDED(2, "ENDED", "已结束"),

            ;

    private static Map<Integer, TravelStatusEnum> typeMap = Arrays
            .stream(TravelStatusEnum.values())
            .collect(Collectors.toMap(TravelStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static TravelStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
